Skip to content

Conversation

@stoyanov-st
Copy link
Contributor

Description:

We observed WARN logs for prematurely empty Action Stack with the latest version of CN.
This PR aims to skip the double finalisation that happens in the case of exceptionally halting contract create ops.

Related issue(s):

Fixes #21821

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@stoyanov-st stoyanov-st added this to the v0.69 milestone Oct 31, 2025
@stoyanov-st stoyanov-st self-assigned this Oct 31, 2025
@stoyanov-st stoyanov-st requested review from a team and tinker-michaelj as code owners October 31, 2025 16:58
@lfdt-bot
Copy link

lfdt-bot commented Oct 31, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #21955      +/-   ##
============================================
- Coverage     70.83%   70.82%   -0.01%     
- Complexity    24457    24460       +3     
============================================
  Files          2680     2680              
  Lines        104501   104502       +1     
  Branches      10968    10968              
============================================
- Hits          74020    74017       -3     
- Misses        26452    26457       +5     
+ Partials       4029     4028       -1     
Files with missing lines Coverage Δ Complexity Δ
...ce/contract/impl/exec/tracers/EvmActionTracer.java 100.00% <100.00%> (ø) 19.00 <0.00> (+1.00)
.../service/contract/impl/exec/utils/ActionStack.java 97.90% <100.00%> (+0.01%) 54.00 <1.00> (+1.00)

... and 4 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codacy-production
Copy link

codacy-production bot commented Oct 31, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%) 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (05e1d11) 104406 78003 74.71%
Head commit (03d478d) 104407 (+1) 77999 (-4) 74.71% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#21955) 2 2 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

* @param to The recipient's EVM address.
* @param amount The number of tokens to mint (using 0 decimals, as defined).
*/
function mintReward(address to, int64 amount) external onlyOwner {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned above this contract was only used to reproduce the issue

* It is NOT an ERC-20 token itself.
* It is given the Supply Key of the HTS token so it can mint rewards.
*/
contract HushSenseManager is Ownable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's HushSense? Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a contract that was causing one of the warnings we observed on mainnet and is only used to reproduce the issue

// to keep the action stack in sync with the message frame stack.
if (hasActionSidecarsEnabled(frame) && haltReason.isPresent()) {
// We skip finalizing for empty action stack, as those produce warnings.
if (hasActionSidecarsEnabled(frame) && haltReason.isPresent() && !actionStack.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really address the root cause? Do we know why the action stack is empty in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root cause is running out of gas during execution of contract create. In this case the EVM is finalising correctly but we try to force a double thus the warnings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another case that was hitting this path was trying to deploy on a occupied address which was also halting with insufficient gas

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stoyanov-st , but why are we calling traceAccountCreationResult twice? Shouldn't it be called only once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate "Action stack prematurely empty" warning

4 participants